import { ProLayoutProps, ProSettings } from '@ant-design/pro-components';
import { RequestConfig } from 'umi';

// 运行时配置

// 全局初始化数据配置，用于 Layout 用户信息和权限初始化
// 更多信息见文档：https://next.umijs.org/docs/api/runtime-config#getinitialstate
export async function getInitialState(): Promise<{ name: string }> {
  return { name: '@umijs/max' };
}

// https://www.cnblogs.com/weschen/p/16843494.html
export const layout = () => {
  return {
    title: 'Antd 可视化生成器',
    logo: 'https://illl.oss-cn-hangzhou.aliyuncs.com/c/ag/icon.jpg',
    menu: {
      locale: false,
      collapsedShowGroupTitle: true,
      navTheme: 'dark',
    },
    layout: 'top',
    contentStyle: {
      height: 'calc(100vh - 56px)',
      padding: 0,
    },
    rightRender: (initInfo: any) => {
      // return { name: '哈哈' };
      // return '哈哈' + JSON.stringify(initInfo);
      return (
        <>
          {/* <a style={{ height: '100%' }} href="https://gitee.com/aeex/ant-design-generate">
            <img src="https://gitee.com/aeex/ant-design-generate/widgets/widget_1.svg" alt="Fork me on Gitee"></img>
          </a> */}
          <a target="_blank" rel="noopener noreferrer" href="https://gitee.com/aeex/ant-design-generate">
            <img src="https://gitee.com/aeex/ant-design-generate/widgets/widget_5.svg" alt="Fork me on Gitee"></img>
          </a>
          <a
            target="_blank"
            rel="noopener noreferrer"
            href="https://gitee.com/aeex/ant-design-generate"
            style={{ width: '80px', textAlign: 'center', fontSize: '20px', color: '#000' }}
          >
            Gitee
          </a>
          {/* <div>
            <a target="_blank" rel="noopener noreferrer" href="https://gitee.com/aeex/ant-design-generate">
              <img src="https://gitee.com/aeex/ant-design-generate/widgets/widget_3.svg" alt="Fork me on Gitee"></img>
            </a>
          </div> */}
        </>
      );
    },
  };
};

export const request: RequestConfig = {
  timeout: 2000,
  // other axios options you want
  errorConfig: {
    errorHandler() {},
    errorThrower() {},
  },
  requestInterceptors: [],
  responseInterceptors: [],
};
